import urllib.request
import easygui as g
import os

msg = '请填写喵的尺寸'
title = '下载一只喵'
fields = ['宽：','高：']
values=g.multenterbox(msg,title,fields)
url= 'http://placekitten.com/%s/%s' % (values[0],values[1])
name = 'cat_%s_%s.jpg' %(values[0],values[1])


response = urllib.request.urlopen(url)
cat_img = response.read()


msg1='请选择存放的位置'
title1='浏览文件'
fullname = g.filesavebox(msg1,title1,name)


dirname=os.path.dirname(fullname)
os.chdir(dirname)


with open(name,'wb') as f:
    f.write(cat_img)
